<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>simCreateForceSensor</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../../index.html" TARGET="_top"><img src="../images/homeImg.png"></a></p>

<h1>Regular API function</h1>
<h3 class=subsectionBar><a name="simCreateForceSensor" id="simCreateForceSensor"></a>simCreateForceSensor / sim.createForceSensor </h3>
<table class=apiTable>
<tr class=apiTableTr> 
<td class=apiTableLeftDescr>
Description 
</td> 
<td class=apiTableRightDescr>Creates a <a href="../forceSensors.htm">force sensor</a>. <br></td>
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCSyn>
C synopsis
</td> 
<td class=apiTableRightCSyn>simInt simCreateForceSensor(simInt options,const simInt* intParams,const simFloat* floatParams,const float* color)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCParam>C parameters</td> 
<td class=apiTableRightCParam>
<div><strong>options</strong>: bit-coded options:</div>
<div class=tab>bit 0 set (1): force threshold enabled</div>
<div class=tab>bit 1 set (2): torque threshold enabled</div>
<div><strong>intParams (input)</strong>: 5 integer parameters:</div>
<div class=tab>intParams[0]: filter type (0=average, 1=median)</div>
<div class=tab>intParams[1]: value count the filter operates on</div>
<div class=tab>intParams[2]: number of consecutive threshold violation for the sensor to break</div>
<div class=tab>intParams[3]: reserved. Set to 0</div>
<div class=tab>intParams[4]: reserved. Set to 0</div>
<div><strong>floatParams (input)</strong>: 5 floating point parameters:</div>
<div class=tab>floatParams[0]: sensor size</div>
<div class=tab>floatParams[1]: force threshold value</div>
<div class=tab>floatParams[2]: torque threshold value</div>
<div class=tab>floatParams[3]: reserved. Set to 0.0</div>
<div class=tab>floatParams[4]: reserved. Set to 0.0</div>
<div><strong>color</strong>: pointer to 2x4x3 values representing the various colors of the sensor ((part1, part2) x (ambient_diffuse rgb, 3 reserved values (set to zero), specular rgb and emission rgb)). Can be nullptr for default values<br>
</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCRet>
C return value
</td> 
<td class=apiTableRightCRet>
<div>-1 if operation was not successful, otherwise the handle of the force sensor</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLSyn>
Lua synopsis
</td> 
<td class=apiTableRightLSyn>int sensorHandle=sim.createForceSensor(int options,table[5] intParams,table[5] floatParams,table[24] color=nil)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLParam>Lua parameters</td> 
<td class=apiTableRightLParam>
<div>Similar to the C-function counterpart</div>
<div></div></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLRet>
Lua return values
</td> 
<td class=apiTableRightLRet>
<div>Similar to the C-function counterpart</div>
<div></div>
</td> 
</tr> 
</table> 


<br>
</td>
</tr>
</table>
</div>
</body>
</html>
